<!-- 公司大事 -->
<template>
    <div class="companyEvent">
        <!-- 大事提醒 -->
        <yn-com-comTitle name="大事提醒"></yn-com-comTitle>
        <yn-event-remind :data="remind" title="大事提醒"></yn-event-remind>
        <!-- 重大事项 -->
        <yn-com-comTitle class="mt15" name="重大事项"></yn-com-comTitle>
        <yn-event-event :data="event"></yn-event-event>
        <!-- 限售解禁 -->
        <yn-com-comTitle class="mt15" name="限售解禁"></yn-com-comTitle>
        <yn-event-limit :data="limit"></yn-event-limit>
        <!-- 十大股东持股变动 -->
        <yn-com-comTitle class="mt15" name="十大股东持股变动"></yn-com-comTitle>
        <yn-event-holder :data="holder"></yn-event-holder>
        <!-- 高管持股变动 -->
        <yn-com-comTitle class="mt15" name="高管持股变动"></yn-com-comTitle>
        <yn-event-manager :data="manager"></yn-event-manager>
        <!-- 龙虎榜单 -->
        <yn-com-comTitle class="mt15" name="龙虎榜单"></yn-com-comTitle>
        <yn-event-excrChange :data="excrChange"></yn-event-excrChange>
    </div>
</template>

<script>
import {eventExcrChange, eventEvent, eventHolder} from "../script/api";

const classNameStr = (ops) => {
    let val = "";
    val = ops.indexOf("-") != -1 ? "colorGreen" : "colorRed";
    if (ops == "不变" || ops == "新进" || ops == null || ops == "") {
        val = "";
    }
    return {val};
};
const handle = (arr) => {
    return arr.map((item) => {
        // item._inrDecNumClass = classNameStr(item.inrDecNum).val;
        item._inrDecNumClass = item.inrDecNum;
        return item;
    });
};
export default {
    data() {
        return {
            event: {}, //重大事项
            remind: [], //大事提醒
            excrChange: {}, //龙虎榜
            manager: [], //高管持
            limit: [], //限售解禁
            holder: [], //十大股东持股变动
        };
    },
    mounted() {
        this.getDataEvent();
    },
    methods: {
        async getDataEvent() {
            //////大事提醒-重大事项/////////////
            const res = await eventEvent();
            this.event = res.event;
            this.remind = res.remind;
            //////限售解禁-十大股东-高管////
            const resHolder = await eventHolder();
            this.limit = resHolder.limit;
            this.holder = handle(resHolder.holder);
            this.manager = resHolder.manager;
            ///////////龙虎榜/////////////
            const resExcrChange = await eventExcrChange();
            this.excrChange = resExcrChange;
        },
    },
};
</script>
<style lang="scss" scoped></style>
